package blog.controller.articles;

import blog.service.CategoryService;
import blog.service.CommentsService;
import blog.vo.Result;
import blog.vo.params.CommentParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.websocket.server.PathParam;

@RestController
@RequestMapping("/categorys")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    // 获取文章专栏
    @GetMapping()
    public Result listCategory(){
        return categoryService.findAll();
    }

    // 获取文章分类的标签
    @GetMapping("/detail")
    public Result categoriesDetail(){
        return categoryService.findAll();
    }

    @GetMapping ("/detail/{id}")
    public Result categoryDetailById(@PathVariable("id") Long id){

        return Result.success(categoryService.findCategoryById(id));

    }
}